<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- Head -->
<head>
    <meta charset="utf-8"/>
    <title>${session.SOFT_NAME }_智能办公系统</title>
    <meta name="description" content="Dashboard"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <%include("/app/resapi/style.html"){}%>
    <script type="text/javascript" src="/gobal/js/jquery/jquery-2.0.3.min.js"></script>
    <script src="/module/suwell/suwell_ofdReader.js"></script>
    <script type="text/javascript">
        var openModeType = "${parameter.openModeType}";
        var serverUrl = "${mServerUrl}"; //服务器地址
        var fileUrl = serverUrl + "/sys/file/openFileOnLine?attachId=${parameter.attachId}";
        var uploadPath = serverUrl + "/office/ofdSwSave?sessionId=${sessionId}&attachId=${parameter.attachId}&fileId=${fileId}";
        var ocx;

        function initObject() {
            var height = document.documentElement.clientHeight;
            var width = document.documentElement.clientWidth;
            if (window.console)
                window.console.log("initObject()");
            else
                alert("initObject()");

            ocx = suwell.ofdReaderInit("OFDActiveXDIV", width + "px", height + "px");
            ocx.setCompsiteVisible("f_save", false);
            if (openModeType == "5" || openModeType == "4") {
                ocx.openFile(fileUrl, false);
            } else if (openModeType == "3") {
                $(".js-save-btn").remove();
                ocx.setCompsiteVisible("f_open", false);
                ocx.setCompsiteVisible("f_save", false);
                ocx.setCompsiteVisible("toolbar_seal", false);
                ocx.openFile(fileUrl, true);
            } else if (openModeType == "2") {
                $(".js-save-btn").remove();
                ocx.setCompsiteVisible("f_open", false);
                ocx.setCompsiteVisible("f_save", false);
                ocx.setCompsiteVisible("toolbar_seal", false);
                ocx.openFile(fileUrl, true);
            } else {
                $(".js-save-btn").remove();
                ocx.setCompsiteVisible("f_open", false);
                ocx.setCompsiteVisible("f_print", false);
                ocx.setCompsiteVisible("f_save", false);
                ocx.setCompsiteVisible("toolbar_seal", false);
                ocx.openFile(fileUrl, true);
            }

        }

        function savePerformed() {
            alert("保存成功");
        }

        //上传文件至远程服务
        function saveFile() {
            ocx.saveFile(uploadPath);
            alert("保存成功");
        }

    </script>

</head>
<body onload="initObject();">
<a href="javascript:void(0);" class="btn btn-success js-save-btn" onclick="saveFile();">${i18n('save')}</a>
<div id="OFDActiveXDIV" style="float:left;"></div>
</body>
<script type="text/javascript">
</script>
</html>
